//  logger.h
//  Progetto Ingegneria del Web
//
//  Created by Andrea Vitale on 16/10/12.
//  Copyright (c) 2012 Andrea Vitale. All rights reserved.

#ifndef Progetto_Ingegneria_del_Web_logger_h
#define Progetto_Ingegneria_del_Web_logger_h

#include "config_manager.h"
#include <stdio.h>

typedef struct logger_t {
    char* current_error_level;
    char* log_error_path;
    char* log_error_filename;
    char* log_error_file_uri;
    char* log_verbose_path;
    char* log_verbose_filename;
    char* log_verbose_file_uri;
    
    float log_max_size;
    
    FILE* log_error_file_pointer;
    FILE* log_verbose_file_pointer;
} logger_t;

logger_t* logger;

void initLogger();
void logMessage(char* level_error_message, char* str);
void preProcessLogFile(char* file_path);

char* getCurrentDate(char* mode);
char* getLogBackupName(char* old_path);

int duplicateLogFile(char* source_path, char* destination_path);

long calculateLogDimension(char* file_path);

#endif
